#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int t, n;
ll a, cur, last, res;

int main()
{
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0);
    cin >> t;
    while (t--)
    {
        cin >> n;
        res = 0;
        for (int i = 1; i <= n; i++)
        {
            cin >> a;
            last = cur, cur = a;
            if (i >= 2)
            {
                res = max(res, last * cur);
            }
        }
        cout << res << endl;
    }
    return 0;
}